#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright (c) 2025 粤港澳大湾区（广东）国创中心

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

File: pyncti_create_volume_mesh.py
Desc: Function to create a volume mesh for selected entities.
Author: xumanjia
Date: 2025-08-01
"""
# 给选中的实体按给定的网格尺寸和网格类型绘制体网格
def pyncti_create_volume_mesh(NCTI,doc):
    doc.ResetCaseResult()
    sel = NCTI.SelectionManager(doc)
    if len(sel.ObjectNames) > 0: 
        size = 1
        type = 0 #0:triangle,1:QuadDominant,2:FullQuad
        res  = doc.ReturnDialogData(-1, "请输入网格参数","网格尺寸", size,"网格类型", type)
        if len(res) > 0:
            name = sel.ObjectNames
            option = {"MeshSize":res[0],"MeshType":res[1]}
            doc.RunCommand("cmd_ncti_create_volume_mesh", name, option)
        else:
            print("取消")
    else:
        print("没有选择数据")